home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / cc / g++-dist / config.g++ < prev    next >
Encoding:
Text File  |  1989-11-05  |  7.9 KB  |  356 lines

  1. #!/bin/sh
  2. # Configuration script for GNU C++
  3. #   Copyright (C) 1988 Free Software Foundation, Inc.
  4.  
  5. #This file is part of GNU CC.
  6.  
  7. #GNU CC is free software; you can redistribute it and/or modify
  8. #it under the terms of the GNU General Public License as published by
  9. #the Free Software Foundation; either version 1, or (at your option)
  10. #any later version.
  11.  
  12. #GNU CC is distributed in the hope that it will be useful,
  13. #but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15. #GNU General Public License for more details.
  16.  
  17. #You should have received a copy of the GNU General Public License
  18. #along with GNU CC; see the file COPYING.  If not, write to
  19. #the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  
  21. #
  22. # Shell script to create proper links to machine-dependent files in
  23. # preparation for compiling g++.  Also, files borrowed verbatim from
  24. # GNU CC have their links made by this program.
  25. #
  26. # Usage: config.g++ [vint] machine
  27. #
  28. # If config.g++ succeeds, it leaves its status in config.status.
  29. # If config.g++ fails after disturbing the status quo, 
  30. #     config.status is removed.
  31. #
  32.  
  33. progname=$0
  34. remove=rm
  35. hard_link=ln
  36. symbolic_link='ln -s'
  37.  
  38. #for Test
  39. #remove="echo rm"
  40. #hard_link="echo ln"
  41. #symbolic_link="echo ln -s"
  42.  
  43. for arg in $*;
  44. do
  45.   case $arg in
  46.    -srcdir=*)
  47.     srcdir=`echo $arg | sed s/-srcdir=//`
  48.     ;;
  49.    -vint)
  50.     vint=on
  51.     ;;
  52.    *)
  53.     machine=$arg
  54.     ;;
  55.   esac
  56. done
  57.  
  58. # Find the source files, if location was not specified.
  59. if [ x$srcdir = x ]
  60. then
  61.     srcdirdefaulted=1
  62.     srcdir=.
  63.     if [ ! -r tree.c ]
  64.     then
  65.         srcdir=..
  66.     fi
  67. fi
  68.  
  69. if [ ! -r ${srcdir}/tree.c ]
  70. then
  71.     if [ x$srcdirdefaulted = x ]
  72.     then
  73.       echo "$progname: Can't find compiler sources in \`${srcdir}'." 1>&2
  74.     else
  75.       echo "$progname: Can't find compiler sources in \`.' or \`..'." 1>&2
  76.     fi
  77.     exit 1
  78. fi
  79.  
  80. if [ x$machine != x ];
  81. then
  82.     case $machine in
  83.     vax)                    # for vaxen running bsd
  84.         ;;
  85.     vms)                    # for vaxen running VMS
  86.         cpu_type=vax
  87.         configuration_file=xm-${machine}.h
  88.         machine_type=${machine}
  89.         ;;
  90.     vax-sysv | vaxv)            # for vaxen running system V
  91.         cpu_type=vax
  92.         configuration_file=xm-vaxv.h
  93.         machine_type=vaxv
  94.         ;;
  95.     sequent-i386)            # for Intel 80386's on Sequent Symmetry
  96.         cpu_type=i386
  97.         configuration_file=xm-i386.h
  98.         machine_type=seq386
  99.         ;;
  100.     i386-sysv | i386v)        # for Intel 80386's running system V
  101.         machine=i386v
  102.         cpu_type=i386
  103.         configuration_file=xm-${machine}.h
  104.         machine_type=${machine}
  105.         ;;
  106.     i386-sysv-gas | i386g)
  107.         cpu_type=i386
  108.         configuration_file=xm-i386v.h
  109.         machine_type=i386gas
  110.         ;;        
  111.     i860)
  112.         ;;
  113.     next )
  114.         cpu_type=m68k
  115.         configuration_file=xm-m68k.h      
  116.         machine_type=next
  117.     ;;
  118.     sun4 | sun-4)
  119.         cpu_type=sparc
  120.         configuration_file=xm-sparc.h
  121.         machine_type=sun4os3
  122.         ;;
  123.     sun3 | sun-3)
  124.         cpu_type=m68k
  125.         configuration_file=xm-m68k.h
  126.         machine_type=sun3
  127.         ;;
  128.     sun3-nfp | sun-3-nfp)
  129.         cpu_type=m68k
  130.         configuration_file=xm-m68k.h
  131.         machine_type=sun3-nfp
  132.         ;;
  133.     sun3-fpa | sun-3-fpa)
  134.         cpu_type=m68k
  135.         configuration_file=xm-m68k.h
  136.         machine_type=sun3-fpa
  137.         ;;
  138.     sun2 | sun-2)
  139.         cpu_type=m68k
  140.         configuration_file=xm-m68k.h
  141.         machine_type=sun2
  142.         ;;
  143.     sun386 | sun386i | roadrunner)
  144.         cpu_type=i386
  145.         configuration_file=xm-sun386i.h
  146.         machine_type=sun386i
  147.         ;;
  148.     sun4-os4 | sun-4-os4)
  149.         cpu_type=sparc
  150.         target_machine=tm-sparc.h
  151.         machine_type=sparc
  152.         ;;
  153.     sun3-os4 | sun-3-os4)
  154.         cpu_type=m68k
  155.         configuration_file=xm-m68k.h
  156.         machine_type=sun3
  157.         ;;
  158.     sun3-nfp-os4 | sun-3-nfp-os4)
  159.         cpu_type=m68k
  160.         configuration_file=xm-m68k.h
  161.         machine_type=sun3-nfp
  162.         ;;
  163.     sun3-fpa-os4 | sun-3-fpa-os4)
  164.         cpu_type=m68k
  165.         configuration_file=xm-m68k.h
  166.         machine_type=sun3-fpa
  167.         ;;
  168.     sun2-os4 |sun-2-os4)
  169.         cpu_type=m68k
  170.         configuration_file=xm-m68k.h
  171.         machine_type=sun2
  172.         ;;
  173.     hp9k320)            # HP 9000 series 300 with gcc alone
  174.         cpu_type=m68k
  175.         configuration_file=xm-hp9k320.h
  176.         ;;
  177.     hp9k320-old)            # HP 9000 series 300 with gcc alone
  178.         cpu_type=m68k
  179.         target_machine=tm-hp9k32old.h
  180.         configuration_file=xm-hp9k320.h
  181.         ;;
  182.     hp9k320-gas | hp9k320g)            #    with gnu as, ld and gdb
  183.         cpu_type=m68k
  184.         configuration_file=xm-hp9k320.h
  185.         ;;
  186.     hp9k320-bsd | hp300)        # HP 9000/3xx running Berkeley Unix
  187.         cpu_type=m68k
  188.         target_machine=tm-hp9k3bsd.h
  189.         ;;
  190.     hp9k800)            # HP 9000 series 800 with g++ alone
  191.         cpu_type=hp9k8
  192.         configuration_file=xm-hp9k8.h
  193.         aux_output=out-hp9k8.c
  194.         machine_type=hp9k8
  195.         ;;
  196.     isi68)
  197.         cpu_type=m68k
  198.         ;;
  199.     news800)
  200.             configuration_file=xm-m68k.h
  201.             target_machine=tm-news.h
  202.         cpu_type=m68k
  203.         ;;
  204.     news-gas | news-g)
  205.             configuration_file=xm-m68k.h
  206.             target_machine=tm-newsgas.h
  207.         cpu_type=m68k
  208.         ;;
  209.     altos | altos3068)        # Altos 3068 with gnu as, ld and gdb
  210.             cpu_type=m68k
  211.             configuration_file=xm-altos3068.h
  212.             target_machine=tm-altos3068.h
  213.             ;;
  214.     3b1)
  215.         cpu_type=m68k
  216.         configuration_file=xm-${machine}.h
  217.         ;;
  218.     sequent-ns32k | sequent)
  219.         cpu_type=ns32k
  220.         aux_output=out-ns32k.c
  221.         ;;
  222.     encore)
  223.         cpu_type=ns32k
  224.         aux_output=out-ns32k.c
  225.         ;;
  226.     genix)
  227.         machine=ns32k
  228.         cpu_type=ns32k
  229.         configuration_file=xm-genix.h
  230.         ;;
  231.     88000)
  232.         cpu_type=m88k
  233.         machine_type=${cpu_type}
  234.         ;;
  235.     alliant)                # Alliant FX/8
  236.         ;;
  237.     convex-c1)                # Convex C1
  238.         machine_type=convex1
  239.         cpu_type=convex
  240.         ;;
  241.     convex-c2)                # Convex C2
  242.         machine_type=convex2
  243.         cpu_type=convex
  244.         ;;
  245.     pyr)
  246.         ;;
  247.     iris)                    # Mostly like a MIPS.
  248.         cpu_type=mips
  249.         target_machine=tm-iris.h
  250.         configuration_file=xm-iris.h
  251.         ;;
  252.     mips)                # Default MIPS environment
  253.         ;;
  254.     mips-sysv)            # SYSV variant of MIPS system.
  255.         cpu_type=mips
  256.         target_machine=tm-mips-sysv.h
  257.             ;;
  258.     mips-bsd43)            # BSD 4.3 variant of MIPS system.
  259.         cpu_type=mips
  260.         target_machine=tm-mips-bsd.h
  261.             ;;
  262.     dec-3100 | decstation)        # Decstation or pmax.
  263.         cpu_type=mips
  264.         target_machine=tm-decstatn.h
  265.             ;;
  266. #    370)
  267. #        machine=370
  268. #        ;;
  269.     esac
  270.  
  271.     $remove -f config.h tm.h md aux-output.c
  272.  
  273.         # if cpu_type is not set, define cpu_type to machine.
  274.         #
  275.     cpu_type=${cpu_type-$machine}
  276.     configuration_file=${configuration_file-xm-$cpu_type.h}
  277.     machine_type=${machine_type-$machine}
  278.     target_machine=${target_machine-tm-${machine_type}.h}
  279.     machine_description=${cpu_type}.md
  280.     aux_output=${aux_output=out-$cpu_type.c}
  281.  
  282.     if [ xx${vint} = xx ]
  283.     then
  284.         files="$configuration_file $target_machine
  285.             $machine_description $aux_output"
  286.         links="config.h tm.h md aux-output.c"
  287.     else
  288.         files="$configuration_file tm-vmc.h $target_machine
  289.             $machine_description $aux_output"
  290.         links="config.h tm.h tm-pre.h md aux-output.c"
  291.     fi
  292.  
  293.     while [ -n "$files" ]
  294.     do
  295.         # set file to car of files, files to cdr of files
  296.         set $files; file=$1; shift; files=$*
  297.         set $links; link=$1; shift; links=$*
  298.  
  299.         if [ ! -r ${srcdir}/config/$file ]
  300.         then
  301.             echo "$progname: cannot create a link \`$link'," 1>&2
  302.             echo "since the file \`config/$file' does not exist." 1>&2
  303.             exit 1
  304.         fi
  305.  
  306.         $remove -f $link
  307.         rm -f config.status
  308.         # Make a symlink if possible, otherwise try a hard link
  309.         $symbolic_link ${srcdir}/config/$file $link 2>/dev/null || $hard_link ${srcdir}/config/$file $link
  310.  
  311.         if [ ! -r $link ]
  312.         then
  313.             echo "$progname: unable to link \`$link' to \`${srcdir}/config/$file'." 1>&2
  314.             exit 1
  315.         fi
  316.         echo "Linked \`$link' to \`${srcdir}/config/$file'."
  317.     done
  318.  
  319.     if [ xx${vint} = xx ]
  320.     then
  321.         echo "Links are now set up for use with a $machine." \
  322.             | tee config.status
  323.     else
  324.         echo "Links are now set up for use with a $machine (vint)." \
  325.             | tee config.status
  326.     fi
  327.  
  328.     # Install a makefile, and make it set VPATH
  329.     # if necessary so that the sources are found.
  330.     # Also change its value of srcdir.
  331.     # Also create a .gdbinit file which runs the one in srcdir
  332.     # and tells GDB to look there for source files.
  333.     case $srcdir in
  334.     .)
  335.         ;;
  336.     *)
  337.         echo "VPATH = ${srcdir}" > x
  338.         cat x ${srcdir}/Makefile | sed "s@^srcdir = \.@srcdir = ${srcdir}@" > Makefile
  339.         rm x
  340.         echo "dir ${srcdir}" > .gdbinit
  341.         echo "source ${srcdir}/.gdbinit" >> .gdbinit
  342.         ;;
  343.     esac
  344.  
  345.     exit 0
  346. else
  347.     echo "Usage: $progname machine"
  348.     echo -n "Where \`machine' is something like "
  349.     echo "\`vax', \`sun3', \`umax', etc."
  350.     if [ -r config.status ]
  351.     then
  352.         cat config.status
  353.     fi
  354.     exit 1
  355. fi
  356.